package com.jd.cmdb.tsc.zk.service;

import org.apache.curator.framework.recipes.cache.NodeCache;
import org.apache.curator.framework.recipes.cache.PathChildrenCache;
import org.apache.curator.framework.recipes.leader.LeaderSelector;

/**
 * Created by tianzhengguo on 2016/1/15.
 */
public interface ZKService {

    //注册client
    void init();

    //判断是否是领导
    boolean isLeader();

    //领导选举
    void selLeader();

    //添加worker监控listener
    void addWatcherListener();

    //当前节点是否存在
    boolean isExist(String path);

    //删除节点
    void delete(String path);

    void start();

    void close();

    String getTSCNode();

    String getWorkerNode();

    LeaderSelector getLeaderSelector();

    //worker节点监控
    PathChildrenCache getWorkerNodeWatcher();

    //tsc节点监控
    NodeCache getTSCNodeWatcher();
}